#region File Header
//----------------------------------------------------------------
// Copyright (C) 2002 Stefan Kyntchev
// All rights reserved.
//
// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY 
// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT 
// LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR 
// FITNESS FOR A PARTICULAR PURPOSE.
//----------------------------------------------------------------
#endregion File Header

using System;
using System.IO;
using System.Web;
using System.Collections;
using AirWeb.Security;
using AirWeb.Security.FileSecurity;
using AirWeb.DirectoryMgr;


namespace AirWeb.ApplicationTools
{
	/// <summary>
	/// Summary description for SecurityFileFilter.
	/// </summary>
	public class SecurityFileFilter
	{
		User m_user;
		DirectoryHelper m_helper;
		
		public SecurityFileFilter(User i_user,HttpContext i_context)
		{
			m_user = i_user;
			m_helper = new DirectoryHelper();
		}

		public void SecurityFileFilterInclude(FileSystemInfo i_di, ArrayList i_currentContent, ref bool i_include)
		{
			// If previous filter has set the include to false - just return
			if(i_include == false)
				return;

			if(m_helper.CanUserAccess(m_user,i_di))
				i_include = true;
			else
				i_include = false;
		}
	}
}
